package com.itheima.controller;

import com.itheima.service.mongo.UserLikeService;
import com.itheima.vo.PageBeanVo;
import com.itheima.vo.UserLikeCountVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/userLike")
public class UserLikeController {

    @Autowired
    private UserLikeService userLikeService;

    @PostMapping("/userLikeSave")
    public void userLikeSave(Long userId, Long likeUserId) {
        userLikeService.save(userId,likeUserId);
    }

    @GetMapping("/isMutualLike")
    public boolean isMutualLike(Long userId, Long likeUserId) {
        return userLikeService.isMutualLike(userId, likeUserId);
    }

    @DeleteMapping("/userLikeDelete")
    public void userLikeDelete(Long userId, Long likeUserId) {
        userLikeService.delete(userId,likeUserId);
    }

    @GetMapping("/findUserCount")
    public UserLikeCountVo findUserCount(Long userId) {
        return userLikeService.findUserCount(userId);
    }

    @GetMapping("/findUserList")
    public PageBeanVo findUserList(Long userId, Integer type, Integer pageNum, Integer pageSize) {
        return userLikeService.findUserList(userId, type, pageNum, pageSize);
    }
}
